home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / MPW / Scripts / OrphanFiles < prev    next >
Encoding:
Text File  |  1993-05-07  |  1.0 KB  |  54 lines  |  [TEXT/MPS ]

  1. #    OrphanFiles - Remove the ckid resource from a list of files.
  2. #
  3. #    Usage:    OrphanFile files…
  4. #
  5. #    OrphanFile removes the ckid resource (if it exists) from a
  6. #    list of files. 
  7. #
  8. #    © Apple Computer, Inc. 1988 - 1993
  9. #    All rights reserved.
  10.  
  11. Set Echo 0
  12. Set Exit 0
  13. Unset CaseSensitive
  14.     
  15. #    Check the parameters
  16.  
  17. If {#} == 0
  18.     Echo "### Usage - {0} files…" > dev:stderr
  19.     Exit 1
  20. End
  21.  
  22.     
  23. For name in {"parameters"}
  24.     Begin
  25.         If "`Exists -f "{name}"`" != ""
  26.             Set path `Files -fr "{name}"`
  27.             Set wind 0
  28.             For i in `Windows`
  29.                 If "{path}" =~ /"{i}"/        ## Make NOT case-sensitive
  30.                     Set wind 1
  31.                     Break
  32.                 End
  33.             End
  34.             Echo "Delete 'ckid';" | Rez -a -m -o "{name}" -noResolve output
  35.             If {wind}
  36.                 If "{path}" =~ /"{active}"/
  37.                     Close "{name}"
  38.                     Open "{name}"
  39.                 Else
  40.                     Close "{name}"
  41.                     Target "{name}"
  42.                 End
  43.             End
  44.         Else
  45.             If "`Exists -d "{name}"`" == ""
  46.                 Echo "### {0}" - File "'{name}'" does not exist. >> dev:stderr
  47.                 Exit 2
  48.             Else
  49.                 Echo "### {0}" - File "'{name}'" is a folder and was ignored. >> dev:stderr
  50.             End
  51.         End
  52.     End
  53. End 
  54.